import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceUploadLogVO, DeviceUploadLogForm, DeviceUploadLogQuery } from '@/api/device/deviceUploadLog/types';

/**
 * 查询日志上传记录列表
 * @param query
 * @returns {*}
 */

export const listDeviceUploadLog = (query?: DeviceUploadLogQuery): AxiosPromise<DeviceUploadLogVO[]> => {
  return request({
    url: '/device/deviceUploadLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询日志上传记录详细
 * @param deviceUploadLogId
 */
export const getDeviceUploadLog = (deviceUploadLogId: string | number): AxiosPromise<DeviceUploadLogVO> => {
  return request({
    url: '/device/deviceUploadLog/' + deviceUploadLogId,
    method: 'get'
  });
};

/**
 * 新增日志上传记录
 * @param data
 */
export const addDeviceUploadLog = (data: DeviceUploadLogForm) => {
  return request({
    url: '/device/deviceUploadLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改日志上传记录
 * @param data
 */
export const updateDeviceUploadLog = (data: DeviceUploadLogForm) => {
  return request({
    url: '/device/deviceUploadLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除日志上传记录
 * @param deviceUploadLogId
 */
export const delDeviceUploadLog = (deviceUploadLogId: string | number | Array<string | number>) => {
  return request({
    url: '/device/deviceUploadLog/' + deviceUploadLogId,
    method: 'delete'
  });
};
